#include <cstdio>

using namespace std;

const int maxn=300000, maxk=18, maxm=300000;

struct Ques {int l, id, v, flag, opt;} que[4*maxm+1];
int n, m, qn, ind[maxn+1], indq[maxn+1], to[2*maxn-1], link[2*maxn-1], dep[maxn+1], up[maxn+1][maxk+1], ans[maxm+1], cnt[2][2*maxn+1];

int read() {
    int ret=0;
    char c;
    for (c=getchar(); c<'0' || c>'9'; c=getchar());
    for (; c>='0' && c<='9'; c=getchar()) ret=ret*10+c-'0';
    return ret;
}

void addEdge(int u, int v) {
    m++;
    to[m] = v;
    link[m] = ind[u];
    ind[u] =m;
}

void build(int o, int fa) {
    dep[o] = dep[fa]+1;
    up[o][0] = fa;
    for (int i=1; i<=maxk; i++) {
        up[o][i] = up[up[o][i-1]][i-1];
    }

    for (int i=ind[o]; i; i=link[i]) {
        if (to[i]!=fa) {
            build(to[i], o);
        }
    }
}

int getLca(int u, int v) {
    if (dep[u]<dep[v]) {
        int temp;
        temp=u, u=v, v=temp;
    }
    for (int i=maxk; i>=0; i--) {
        if (dep[up[u][i]]>=dep[v]) u=up[u][i];
    }
    if (u==v) return u;
    for (int i=maxk; i>=0; i--) {
        if (up[u][i]!=up[v][i]) {
            u=up[u][i], v=up[v][i];
        }
    }
    return up[u][0];
}

void addQues(int o, int id, int v, int flag, int opt) {
    qn++;
    que[qn].l=indq[o];
    que[qn].id=id, que[qn].id=id, que[qn].v=v, que[qn].flag=flag;
    que[qn].opt=opt;
    indq[o] = qn;
}

void solve(int o) {
    cnt[0][o+dep[o]]++;
    cnt[1][n+dep[o]-o]++;

    for (int i=indq[o]; i; i=que[i].l) {
        ans[que[i].id]+=que[i].flag*cnt[que[i].opt][que[i].v];
    }

    for (int i=ind[o]; i; i=link[i]) {
        if (to[i]!=up[o][0]) {
            solve(to[i]);
        }
    }

    cnt[0][o+dep[o]]--;
    cnt[1][n+dep[o]-o]--;
}

int main() {
    freopen("query.in", "r", stdin);
    freopen("query.out", "w", stdout);

    int m;
    n=read(), m=read();
    for (int i=1; i<n; i++) {
        int u=read(), v=read();
        addEdge(u, v);
        addEdge(v, u);
    }
    build(1, 0);

    for (int i=1; i<=m; i++) {
        int l=read(), r=read(), lca=getLca(l, r), dis=dep[l]+dep[r]-dep[lca]*2;
        addQues(l, i, dep[l], 1, 0);
        addQues(up[lca][0], i, dep[l], -1, 0);
        addQues(r, i, n+dep[r]-dis, 1, 1);
        addQues(lca, i, n+dep[r]-dis, -1, 1);
    }

    solve(1);

    for (int i=1; i<=m; i++) printf("%d\n", ans[i]);

    fclose(stdin);
    fclose(stdout);
    return 0;
}
